import tushare as ts
import pandas as pd
import matplotlib.pyplot as plt

from common.enum.form_items_key import FormItemsKey
from service.das.data_map_das import DataDictionaryDas

# 获取一年前的日期
dataMap = DataDictionaryDas()
result = dataMap.get_item_by_form_enum(FormItemsKey.TUSHARE_TOKEN)
ts.set_token(result.dict_value)

pro = ts.pro_api()


def getDayStock(stockCode, startDate, endDate):
    return pro.daily(ts_code=stockCode, start_date=startDate, end_date=endDate)


def getRealTime(stockCode):
    return ts.realtime_quote(ts_code=stockCode)
